package com.bkitmobile.kesu.android.GUI;
import com.bkitmobile.kesu.android.connectServer.staticClass;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

public class main extends Activity {
    /** Called when the activity is first created. */
	public static final int HANDLER_MSG_WAIT = 1;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        System.out.println(getApplication().toString());
        setContentView(R.layout.main);
        //mConnection = new ServiceLocationConnection();
        //bindService(new Intent(getApplicationContext(), 
	            //UpdateLocationService.class), mConnection, Context.BIND_AUTO_CREATE);
		
		//service = ((ServiceLocationConnection)mConnection).getService();
        //startActivity(new Intent(this, Login.class));
        Handler mHandler = new Handler() {
    		@Override
    		public void handleMessage(Message msg) {
    			super.handleMessage(msg);
    			
    			Intent intent = null;
    			if (staticClass.isRunning)
    			{
    				intent = new Intent(getApplicationContext(), 
        					FriendsList.class);
    			}	
    			else intent = new Intent(getApplicationContext(), 
    					Login.class);
    			startActivity(intent);
    			finish();
    		}
        };
        if (!staticClass.isRunning) 
        	mHandler.sendEmptyMessageDelayed(HANDLER_MSG_WAIT, 2000);//thay tam ve 0 - doi lai 2000 sau
        else mHandler.sendEmptyMessageDelayed(HANDLER_MSG_WAIT, 200);
       // finish();
       
    }
    public void onResume() {
		super.onResume();
		System.out.println("main resume");
	}
    
    public void onRestart() {
		super.onRestart();
		System.out.println("Restart");
	}
}